﻿using SlamDunk.ValueObjects.Enums;
using System;

namespace SlamDunk.MES.DataDrive.Bussiness.Models.StockContext
{
    /// <summary>
    /// 库存单据类
    /// </summary>
    public class StockOrderClass
    {
        public string 库存单据类编号 { get; set; }
        public string 库存单据类名称 { get; set; }
        public string 出入库方向类型 { get; set; }
        public string 是否生成条码 { get; set; }
        public string 工厂模型编号 { get; set; }
        public string 描述 { get; set; }
        internal StockDirectionType DirectionType { get; set; }
        internal bool? GenerateBarcode { get; set; }
        public void ConverterValue()
        {
            if (!string.IsNullOrWhiteSpace(this.出入库方向类型))
            {
                this.DirectionType = (StockDirectionType)Enum.Parse(typeof(StockDirectionType), this.出入库方向类型.Substring(0, this.出入库方向类型.IndexOf("(", StringComparison.Ordinal)));
            }
            if (!string.IsNullOrWhiteSpace(this.是否生成条码))
            {
                this.GenerateBarcode = bool.Parse(this.是否生成条码);
            }
        }
    }
}
